home *** CD-ROM | disk | FTP | other *** search
- class classes.bro.TwistLaser
- {
- var x;
- var y;
- var id;
- var dir;
- var pos;
- var clip;
- var axis;
- var w;
- var h;
- var xwcI;
- var ywcI;
- var exploX;
- var exploY;
- var xMov = 0;
- var yMov = 0;
- var power = 4;
- var xwc = 0;
- var ywc = 0;
- function TwistLaser(px, py, pDir, pPos, pid)
- {
- this.x = px;
- this.y = py;
- this.id = pid;
- this.dir = pDir;
- this.pos = pPos;
- _root.d = _root.d + 1;
- this.clip = _root.attachMovie("twistLaser","twistLaser" + this.id + "Clip",_root.d);
- this.clip._x = this.x;
- this.clip._y = this.y;
- this.clip.id = this.id;
- if(this.dir == "U")
- {
- this.axis = "y";
- this.yMov = -22;
- this.xMov = 0;
- this.y += 22;
- }
- else if(this.dir == "D")
- {
- this.axis = "y";
- this.yMov = 22;
- this.xMov = 0;
- this.y -= 22;
- }
- else if(this.dir == "R")
- {
- this.axis = "x";
- this.yMov = 0;
- this.xMov = 22;
- this.x -= 22;
- }
- else
- {
- this.axis = "x";
- this.yMov = 0;
- this.xMov = -22;
- this.x += 22;
- }
- this.clip.gotoAndStop(this.dir);
- this.w = this.clip._width;
- this.h = this.clip._height;
- this.xwcI = !(this.dir == "L" || this.dir == "R") ? 0.5 : 0;
- this.ywcI = !(this.dir == "L" || this.dir == "R") ? 0 : 0.5;
- _root.stats.fired = _root.stats.fired + 1;
- }
- function hit()
- {
- _root.stats.hit = _root.stats.hit + 1;
- _root.createGunExplo([this.exploX,this.exploY,_root.randRange2(50,80)]);
- _root.removeBroShot("twistLaser" + this.id);
- }
- function main()
- {
- this[this.axis + "Mov"] *= 1.03;
- if(this.x > 1075 || this.x < -75 || this.y > 675 || this.y < -75)
- {
- _root.removeBroShot("twistLaser" + this.id);
- }
- if(this.pos == "top")
- {
- this.x += this.xMov + 2.5 * Math.sin(this.xwc += this.xwcI);
- this.y += this.yMov + 2.5 * Math.sin(this.ywc += this.ywcI);
- }
- else
- {
- this.x += this.xMov + -2.5 * Math.sin(this.xwc += this.xwcI);
- this.y += this.yMov + -2.5 * Math.sin(this.ywc += this.ywcI);
- }
- this.clip._x = this.x;
- this.clip._y = this.y;
- }
- }
-